import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { PageTool } from "../../../common/global/PageTool";
import { Language } from "../../../../extend/language/Language";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { PetIslandApplyInfoItemRenderer } from "./renderer/PetIslandApplyInfoItemRenderer";
import { PageSelecter } from "../common/pageSelect/PageSelecter";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { GTileList } from "../../../../com/mui/controls/GTileList";
//class PetIslandApplyInfoPanel
    
    export  class PetIslandApplyInfoPanel extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this._pageTool = new PageTool([], 6);
            setSize(260, 320);
            titleHeight = 26;
            title = Language.getString(28229);
            return;
        }

        /* internal  */onEquipmentPageChange(arg1: Object /* flash.events.Event */=null): void
        {
            var loc1=this._petPageSelecter.currentPage;
            this._petList.dataProvider = new DataProvider(this._pageTool.getByPageNo(loc1));
            this._petList.drawNow();
            return;
        }

        public set petListData(arg1: Array<any>)
        {
            if (arg1) 
            {
                this._pageTool.array = arg1;
                this._petPageSelecter.currentPage = 1;
                this._petPageSelecter.maxPage = this._pageTool.pagesCount;
                this._petList.dataProvider = new DataProvider(this._pageTool.getByPageNo(1));
                this._memberNum.text = Language.getStringByParam(28180, arg1.length);
            }
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(18, 38, 224, 245, this);
            ObjCreate.createBg(20, 68, 220, 2, this, ImagesConst.SplitLine);
            ObjCreate.createGTextField(Language.getString(28178), 18, 45, 110, 20, this, GlobalStyle.setTextFormatAlign(GlobalStyle._textFormat2, flash.text.TextFormatAlign.CENTER));
            ObjCreate.createGTextField(Language.getString(28179), 128, 45, 110, 20, this, GlobalStyle.setTextFormatAlign(GlobalStyle._textFormat2, flash.text.TextFormatAlign.CENTER));
            if (!this._petList) 
            {
                this._petList = ObjCreate.createTileList(18, 70, 230, 210);
            }
            this._petList.scrollPolicy = ScrollPolicy.OFF;
            this._petList.columnWidth = 338;
            this._petList.rowHeight = 33;
            this._petList.setStyle("cellRenderer", PetIslandApplyInfoItemRenderer);
            this.addChild(this._petList);
            this._petPageSelecter = ObjCreate.createPageSelecter(65, 288, this);
            this._petPageSelecter.mode = PageSelecter.CompleteMode;
            this._petPageSelecter.addEventListener(flash.events.Event.CHANGE, this.onEquipmentPageChange);
            this._memberNum = ObjCreate.createGTextField("", 190, 288, 60, 20, this, GlobalStyle._textFormat5);
            return;
        }

        /* internal */ /* var */_memberNum: GTextFiled;

        /* internal */ /* var */_petList: GTileList;

        /* internal */ /* var */_petPageSelecter: PageSelecter;

        /* internal */ /* var */_pageTool: PageTool;
    }
